#写文件到excle
import pandas as pd

a1 = {'name':'xiaohong','age':20}
a2 = {'name':'xiaohong','age':21}
a3 =  {'name':'xiaohong','age':21}
l = [a1,a2,a3]
print(l)
#需要将列表变成datafreame格式
df1 = pd.DataFrame(l)
print(df1)
#使用pandas的函数to-excle(),index索引
df1.to_excel('222.xlsx',index=False)